        PROGRAM ISTDT
 
        INTEGER TKNPTH(134),OUTPTH(134),PLOPTH(134),
     +          CIPTH(134),CMTPTH(134),OPTSTR(134),I,STATUS,
     +          IODTKN,IODCMT,IODCI,NERROR,NWARN,DESCI,IODOUT,
     +          PLOPT(134),IODPLO,NOOPTS(2)
 
        INTEGER TMPFIL
 
        INTEGER YPARSE,GETARG,OPEN,CREATE,ZYINCI,ZTKPTI,ZTKGTI,EQUAL
        EXTERNAL YPARSE,ZINIT,ZMESS,REMARK,ZQUIT,GETARG,OPEN,CREATE,
     +           ZCHOUT,ZPTINT,PUTCH,REMOVE,SEEK,ZYINCI,ZTKPTI,ZTKGTI,
     +           EQUAL
 
        DATA (CIPTH(I),I=1,11)/108,121,112,99,109,105,46,
     +116,109,112,129/
        DATA  NOOPTS/45,129/
 
        CALL ZINIT
        CALL INISTR
        CALL INISYM
        CALL INITRE
        NERROR=0
        NWARN=0
 
        IF (GETARG(1,TKNPTH,81).EQ.-100) CALL NAMES(1,TKNPTH)
        IF (GETARG(2,CMTPTH,81).EQ.-100) CALL NAMES(2,CMTPTH)
        IF (GETARG(3,OUTPTH,81).EQ.-100) CALL NAMES(3,OUTPTH)
        IF (GETARG(4,OPTSTR,81).EQ.-100) CALL NAMES(4,OPTSTR)
        IF (GETARG(5,PLOPTH,81).EQ.-100) CALL NAMES(5,PLOPTH)
 
        IODTKN=OPEN(TKNPTH,0)
        IF (IODTKN.EQ.-1) CALL ERROR('Token Stream Open Failed')
        IODCMT=OPEN(CMTPTH,0)
        IF (IODCMT.EQ.-1) CALL ERROR('Comment Stream Open Failed')
        IODOUT=CREATE(OUTPTH,1)
        IF (IODOUT.EQ.-1) CALL ERROR('Output File Create Failed')
        IF (PLOPTH(1).NE.129 .AND. EQUAL(PLOPTH,NOOPTS).EQ.-3) THEN
          IODPLO=OPEN(PLOPTH,0)
          IF (IODPLO.EQ.-1) CALL ERROR('Can''t Open option file')
        ELSE
          IODPLO=-1
        END IF
 
 
        IODCI=TMPFIL(CIPTH)
        IF (IODCI.EQ.-1) CALL ERROR('Scratch File Creation Failed')
 
        IF (YPARSE(IODTKN,IODCMT,-1,IODCI,NERROR,NWARN).EQ.0) THEN
            IF (NERROR.GT.0) THEN
                CALL ZCHOUT('[ISTDT Terminated, ',1)
                CALL ZPTINT(NERROR,1,1)
                CALL ZCHOUT(' er'//'ror',1)
                IF (NERROR.GT.1) CALL PUTCH(115,1)
                CALL ZMESS(']',1)
                STATUS=-1
            ELSE
                CALL SEEK(0,IODCI)
                CALL SEEK(0,IODCMT)
                IF (ZYINCI(IODCI).EQ.-1) CALL ERROR(
     +              'Internal Error: Couldn''t reread comment index')
                IF (IODPLO.NE.-1) CALL PLOPTF(IODPLO)
                DO 100 I=6,10
                    IF (GETARG(I,PLOPT,134).NE.-100)
     +                  CALL POLOPT(PLOPT,.FALSE.)
 100            CONTINUE
                DESCI=ZTKGTI(2,0,0)
                CALL DS(OPTSTR,IODCMT,ZTKPTI(0,IODOUT,DESCI),NERROR,
     +                  NWARN)
                IF (NERROR+NWARN.EQ.0) THEN
                    CALL ZMESS('[ISTDT Normal Termination]',1)
                    STATUS=-2
                ELSE IF (NERROR.EQ.0) THEN
                    CALL ZCHOUT('[ISTDT Terminated, ',1)
                    CALL ZPTINT(NWARN,1,1)
                    CALL ZCHOUT(' war'//'ning',1)
                    IF (NWARN.GT.1) CALL PUTCH(115,1)
                    CALL ZMESS(']',1)
                    STATUS=-1002
                ELSE
                    CALL ZCHOUT('[ISTDT Terminated, ',1)
                    CALL ZPTINT(NERROR,1,1)
                    CALL ZCHOUT(' er'//'ror',1)
                    IF (NERROR.GT.1) CALL PUTCH(115,1)
                    CALL ZMESS(']',1)
                    STATUS=-1
                END IF
            END IF
        ELSE
            CALL REMARK('[ISTDT Fatal Error -- Terminated]')
            STATUS=-1001
        END IF
 
        CALL CLOSE(IODCI)
        CALL REMOVE(CIPTH)
 
        CALL ZQUIT(STATUS)
 
        END
C ----------------------------------------------------------------------
C
C       N A M E S   -   Input the pathname of a required file from stdin
C
 
        SUBROUTINE NAMES(NUMBER,PATH)
        INTEGER NUMBER,PATH(*)
 
        INTEGER JUNK,PROMPT(21,5)
 
        SAVE PROMPT
 
        INTEGER ZGTCMD
        EXTERNAL ZGTCMD,ZPRMPT
 
C "Input token stream: "
C "Input comment file: "
C "Output file: "
C "DS options: "
C "PL option file: "
 
        DATA (PROMPT(I,1),I=1,21)/73,110,112,117,116,32,116,
     +111,107,101,110,32,115,116,114,101,97,109,58,
     +32,129/,
     +       (PROMPT(I,2),I=1,21)/73,110,112,117,116,32,99,
     +111,109,109,101,110,116,32,102,105,108,101,58,
     +32,129/,
     +       (PROMPT(I,3),I=1,14)/79,117,116,112,117,116,32,
     +102,105,108,101,58,32,129/,
     +       (PROMPT(I,4),I=1,13)/68,83,32,111,112,116,105,
     +111,110,115,58,32,129/,
     +       (PROMPT(I,5),I=1,17)/80,76,32,111,112,116,105,
     +111,110,32,102,105,108,101,58,32,129/
 
        CALL ZPRMPT(PROMPT(1,NUMBER))
        JUNK=ZGTCMD(PATH,0)
 
        END
